#include<iostream>
#include<ctime>
#include"Task.hpp"
#include"ThreadPool.hpp"
using namespace std;

int main()
{
    cout << "process run..." << endl;
    sleep(3);

    ThreadPool<Task> *tp = ThreadPool<Task>::GetInstance();
    tp->Start();
    srand(time(nullptr)^getpid());

    while(true)
    {
        // 1.创建任务
        int x = rand() % 10 + 1;
        usleep(10);
        int y = rand() % 5;
        char op = opers[rand() % opers.size()];

        Task t(x, y, op);
        tp->Push(t);

        // 2.处理任务
        cout << "main thread has made task: " << t.GetTask() << endl;

        sleep(1);
    }

    return 0;
}